<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="__ROOT__/static/plugins/bootstrap/css/bootstrap.css">
    <script src="__ROOT__/static/plugins/jquery-3.2.1/jquery-3.2.1.min.js"></script>
    <script src="__ROOT__/static/plugins/layer/layer.min.js"></script>
</head>
<body>
商品分类名称<font color='red'>*</font>：
<input type='text' id='type_name'  value='{$rows["type_name"]}'/>
<input type='hidden' id='catid'  value='{$rows["id"]}'/>
<br><br>
<div>
    <button type="button" class="btn btn-success"  onclick="doUpdateCat()" >保&nbsp;存</button>
    <a class="btn btn-primary" href='{:url("Admin/Goodscats/index")}'>返&nbsp;回</button></a>
</div>
</body>
<script>
    function doUpdateCat(){
        var type_name = $('#type_name').val();
        var catid = $('#catid').val();
        if( type_name ==''){
            layer.msg('内容不能为空', {icon: 16});
            return;
        }
        var params={};
        params.type_name=type_name;
        params.id=catid;
        $.post("{:url('Admin/Goodscats/doUpdateCat')}", params, function (data) {
            if (data > 0) {
                layer.msg('操作成功', {icon: 1, time: 3000});
                setTimeout('window.location.href = "{:url(\'Admin/Goodscats/index\')}"',2000);
            } else {
                layer.msg('操作失败', {icon: 2, time: 3000});
            }
        })
    }
</script>
</html>